const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [],
    empty: false,
  },


  onLoad: function (options) {
    this.is_franchiser = options.is_franchiser || "";
    let user_id = options.user_id;
    this.getUserCardList(user_id);
  },

  getUserCardList(user_id) {
    const param = {
      user_id,
      page: 1,
      row: 1000,
      card_number: ""
    }
    if (this.is_franchiser) {
      param.type = 1;
    }
    app.ajax({
      url: "Partner/Users/userCard",
      data: param,
      success: res => {
        if (res.data.code > 0) {
          this.setData({
            list: res.data.data.list,
            empty: res.data.data.count == 0 ? true : false
          })
        } else {
          this.setData({
            empty: true
          })
        }
      },
      fail: error => {
        app.showToast("获取水卡数据失败");
      }
    })
  },


})